<?php

namespace app\admin\model\finance\extract;

use think\Model;

class Books extends Model
{
    // 表名
    protected $name = 'finance_extract_books';
    
    // 自动写入时间戳字段
    protected $autoWriteTimestamp = 'int';

    // 定义时间戳字段名
    protected $createTime = 'createtime';
    protected $updateTime = 'updatetime';
    
    // 追加属性
    protected $append = [
        'pay_type_text',
        'status_text',
        'day_text',
    ];
    

    
    public function getPayTypeList()
    {
        return ['1' => __('Books.Pay_type 1'),'2' => __('Books.Pay_type 2')];
    } 
	public function getStatusList()
    {
        return ['1' => __('Books.Status 1'),'2' => __('Books.Status 2'),'3' => __('Books.Status 3')];
    }     
	public function getDayList()
    {
        return ['1' => __('Books.Day 1'),'2' => __('Books.Day 2'),'3' => __('Books.Day 3'),'4' => __('Books.Day 4'),'5' => __('Books.Day 5'),'6' => __('Books.Day 6'),'7' => __('Books.Day 7')];
    }     


    public function getPayTypeTextAttr($value, $data)
    {        
        $value = $value ? $value : $data['pay_type'];
        $list = $this->getPayTypeList();
        return isset($list[$value]) ? $list[$value] : '';
    }


    public function getStatusTextAttr($value, $data)
    {        
        $value = $value ? $value : $data['status'];
        $list = $this->getStatusList();
        return isset($list[$value]) ? $list[$value] : '';
    }
    public function getDayTextAttr($value, $data)
    {        
        $value = $value ? $value : $data['day'];
        $list = $this->getDayList();
        return isset($list[$value]) ? $list[$value] : '';
    }
	




}
